<!doctype html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

<div id="app">

    <my-component></my-component>
    <my-component2></my-component2>

</div>


</body>
<script src="../../../vender/vue@2.4.2.js"></script>
<script>
    var bus=new Vue();


    var myComponent={
        template:'<input type="button" value="A" @click="updateB"/>',
        methods:{
            updateB: function () {
                console.log('updateB');
                bus.$emit('upa');
            }
        }
    };

    var myComponent2={
        template:'<input type="button" value="B" @click="updateA"/>',
        methods:{
            updateA: function () {
                console.log('updateA');
                bus.$emit('upb');
            }
        }
    };

    var app=new Vue({
        el:'#app',
        components:{
            'my-component':myComponent,
            'my-component2':myComponent2
        }
    });


</script>
</html>